package cn.mxb.logic.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.mxb.floor.pagination.Result;
import cn.mxb.logic.dao.SysFamilyDAO;
import cn.mxb.logic.entity.SysFamily;
import cn.mxb.logic.service.ISysFamilyService;

@Service("sysFamilyService")
public class SysFamilyServiceImpl  implements ISysFamilyService {

	@Autowired
	private SysFamilyDAO sysFamilyDAO;
	
	
	@Override
	public SysFamily findByProperty(String property, String value) {
		return sysFamilyDAO.findByProperty(property, value);
	}

	/**
	 * 分页
	 */
	@Override
	public Result<SysFamily> find(SysFamily sysFamily, int page, int row) {
		return sysFamilyDAO.find(sysFamily, page, row);
	}

	/**
	 * add
	 */
	@Override
	public SysFamily add(SysFamily SysFamily) {
		return sysFamilyDAO.save(SysFamily);
	}

	@Override
	public void delete(int id) {
		sysFamilyDAO.remove(SysFamily.class,id);
	}
	@Override
	public void update(SysFamily SysFamily) {
		
	}
	
	@Override
	public List<SysFamily> findListByProperty(String property, String value) {
		return sysFamilyDAO.findListByProperty(property, value);
	}

	/**
	 * 查询全部
	 */
	@Override
	public List<SysFamily> findAllList() {
		return sysFamilyDAO.getAll(SysFamily.class);
	}

	@Override
	public List<SysFamily> findListByPropertyTwo(String property, String value, String property2, String value2) {
		List<SysFamily> list = null;
		try{
			list = sysFamilyDAO.findListByPropertyTwo(property,value,property2,value2);
		}catch(Exception e){
			System.out.println(e);
		}
		return list;
	}
	/**
     * 修改table表的field字段为fieldvalue根据property的value
     * @param table
     * @param field
     * @param property
     * @param value
     * @param fieldvalue
     */
	@Override
	public void updatetablebyproperty(String table, String field, String property, String value, int fieldvalue) {
		try{
			sysFamilyDAO.updatetablebyproperty(table, field, property, value, fieldvalue);
		}catch(Exception e){
			System.out.println(e);
		}
	}


	
}
